/*
 * File:         DataTest.java
 * Author:       Robert Bittle <guywithnose@gmail.com>
 */
package tests;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.junit.After;
import org.junit.Before;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalRdbmsServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;

import foxtrotbravo.Config;

/**
 * The Class DataTest.
 * 
 * @author Dude
 */
@SuppressWarnings("static-method")
public class AppEngineTest {

	/** The Constant helper. */
	private static final LocalServiceTestHelper helper = new LocalServiceTestHelper(
			new LocalRdbmsServiceTestConfig(), new LocalUserServiceTestConfig())
			.setEnvIsLoggedIn(true).setEnvEmail("dude@gmail.com")
			.setEnvAuthDomain("gmail.com");

	/**
	 * Sets the up.
	 */
	@Before
	public void setUp() {
		HashMap<String, Object> attribs = new HashMap<String, Object>();
		attribs.put("com.google.appengine.api.users.UserService.user_id_key", "test User Id");
		helper.setEnvAttributes(attribs);
		helper.setUp();

		Enumeration<String> loggers = LogManager.getLogManager()
				.getLoggerNames();
		while (loggers.hasMoreElements()) {
			Logger.getLogger(loggers.nextElement()).setLevel(Level.OFF);
		}
		
		Config.setTesting();

	}

	/**
	 * Tear down.
	 */
	@After
	public void tearDown() {
		helper.tearDown();
	}

}
